package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	var w io.Writer
	w = os.Stdout
	rw := w.(io.ReadWriter) // 断言成功，(*os.File) 的确有 Read 和 Write 方法

	_, pw := io.Pipe() // func Pipe() (*PipeReader, *PipeWriter)
	w = pw
	rw = w.(io.ReadWriter) // panic, 断言失败。（*PipeWriter) 并没有实现 Read 方法
	fmt.Println(rw)
}
